import requests

# 视频URL
video_url = "http://v3-dy.ixigua.com/dde8053f8bcd72692e4c8d531c043dd4/5fa0c09e/video/tos/cn/tos-cn-ve-15/6a298f365db244be80c21eae36857862/?a=1128&br=3960&bt=1320&cr=0&cs=0&cv=1&dr=0&ds=3&er=&l=202011030929330101980570965D53A72F&lr=aweme_search_suffix&mime_type=video_mp4&qs=0&rc=ajM1ZWt1aHU2eDMzZmkzM0ApNDNpNWU1Mzs5N2hkaGg8NGc1czVka3FlMGNfLS0tLS9zczVjMDIxNTUzMS4uMjAwYjE6Yw%3D%3D&vl=&vr="

# 发送请求
r = requests.get(url=video_url, stream=True)

reponse_body_lenth = int(r.headers.get("Content-Length"))
print("body的数据长度为:", reponse_body_lenth)

# 获取响应内容存储到文件
with open("存1万到银行试试看.mp4", 'wb') as fd:
    write_all = 0
    for chunk in r.iter_content(chunk_size=100):
        write_all += fd.write(chunk)  # write的返回值为写入到文件内容的多少
        print("下载进度: %02.6f%%" % (100 * write_all / reponse_body_lenth))
